using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;

namespace dender.dvdcover.core.image
{
    /// <summary>
    /// A CenterResize resizes an image to a specific aspectRatio by resizing and cropping 
    /// the image. This will crop edges to get the correct aspectRatio, but crops an equal 
    /// portion on every edge of the image.
    /// </summary>
    public class CenterResizeStyle : IResizeStyle
    {
        #region IResizeStyle Members

        public void Resize(Bitmap sourceImage, float aspectRatio, out Bitmap destinationImage)
        {
            Size NewSize = ImageProcessing.CalculateNewDimensions(sourceImage, aspectRatio);
            destinationImage = ImageProcessing.CenterExctractImage(sourceImage, NewSize);
        }
        
        #endregion
    }
}
